package com.hankcs.lda;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.List;

import com.hankcs.hanlp.HanLP;
import com.hankcs.hanlp.seg.common.Term;
import com.smart.util.IOUtil;


public class FileSpliter {

	public static void main(String[] args) throws Exception {
		List<String> lines = IOUtil.readLines(new FileInputStream("D:\\workspace\\LDA4j\\data\\temp\\1.txt"));
		for(int i=0; i<lines.size(); i++) {
			List<Term> termList  = HanLP.segment(lines.get(i));
			PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream("D:\\workspace\\LDA4j\\data\\sample\\" + i + ".txt"), "UTF-8"));
			Iterator<Term> itr = termList.iterator();
			itr = termList.iterator();
			while(itr.hasNext()) {
				Term term = itr.next();
				writer.println(term.word); 
			}
			writer.close();
		}
	}
}
